-
Notifications
You must be signed in to change notification settings - Fork 1
Configure app from file using internal config package #35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
dda6956 to
5f63567
Compare
|
For parity's sake, shouldn't It is strange that they are different, because fundamentally they kinda are the same, no? |
Yes this is absolutely to be discussed in this PR. I was thinking of making the change, but decided against it before we addressed it. I'm totally find having the slack channels be a list. However I do fail to see in which scenario would it be used as a list 🤔 Whereas for emails it is pretty clear. So it makes me wonder if we should make it a list for parity's sake, or keep it a value for how it will be used |
scastlara
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
Just a comment about docstrings not following conventions, and a question about the API parity between slack/email!
| } | ||
|
|
||
| // Returns valueA if != nil, otherwise valueB if != nil, otherwise the provided default value | ||
| func getCliOrFileOption[T interface{}](valueA *T, valueB *T, def T) (r T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🏅
I could see some companies/groups/teams being organized in a way such that they want to send the reports to multiple slack channels: one for security, one for PMs, one for Devs. Or any other combination. Not saying it is the most useful thing to do, but it is not a crazy feature, especially since the API will kinda be prepared to send a report to multiple places anyway (because of emails). |
|
Thinking about the API "holistically" (so not this PR, just before 1.0.0) I am still not sold on |
Changes urls -> targets Changes slack-channel -> slack-channels Adds readme with details of all configuration options
Description
The TOML parsing offered by the CLI package we use is limited and doesn't seem to support dictionaries, etc (see here)
To be able to fully use TOML and therefore provide the nicest interface we can, I propose here to parse the config ourselves.
To do this, I first moved some files around in #34
And here I am using this new internal
configpackage to parse the config file ourselves.Changes made
As a recap:
config.GetPatrolConfigurationtomlpackageCombineBeforeFuncsout!GetConfigFileLoaderout! Go CLI parsing out!)Interface discussion
There are some interface changes. Not sure if it's worth it to show the comparison, maybe I can just post the new interface and we can discuss from there.
CLI options (unchanged in this PR)
File configuration